#include "C_SpaceObjectFactory.h"


C_SpaceObjectFactory::C_SpaceObjectFactory(C_Map *map)
{
	m_map = map;
}


C_SpaceObjectFactory::~C_SpaceObjectFactory()
{
	FOR_VEC_I(it, m_objects, VC_Object*)
	{
		delete (*it);
	}
	m_objects.clear();
}

void C_SpaceObjectFactory::handleEvent(sf::Event e)
{
	VC_Drawable::handleEvent(e);
	//WR("SIZE: " << m_objects.size())
	FOR_VEC_I(it, m_objects, VC_Object*)
	{
		(*it)->handleEvent(e);
	}
}

void C_SpaceObjectFactory::render()
{
	//WR("SIZE: " << m_objects.size())
	FOR_VEC_I(it, m_objects, VC_Object*)
	{
		(*it)->render();
	}
}

void C_SpaceObjectFactory::update()
{
	//WR("SIZE: " << m_objects.size())
	FOR_VEC_I(it, m_objects, VC_Object*)
	{
		if (*it == NULL) continue;
		(*it)->update();
	}
}

void C_SpaceObjectFactory::remove(S_Rangei x, S_Rangei y)
{
	WR("BEFORE DELETE SIZE: " << m_objects.size())
		m_objects.clear();
}
